11/3/2020

Rating by Type

## Warning: Removed 205 rows containing non-finite values (stat_density).

Code for the Plot

#load necessary packages
library(dplyr)
library(ggplot2)
library(plotly)

#load and format data
anime <- read.csv("anime.csv", 
        colClasses = c("name"="character", "genre"="character"))

anime = anime %>% 
        filter(!type == "")%>%
        group_by(type)

Code (cont.)

#Make ggplot
gg <- ggplot(data = anime, aes(rating)) +
        geom_density(aes(fill = type), alpha = 0.4) +
        xlim(0, 10) +
        labs(x="Rating (out of 10)", 
             y="Density", 
             title="Distribution of Ratings by Anime Type")

#Convert into a plotly interactive plot
ggplotly(gg)